
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>配送方式-订单详情</title>
    {include file="public/head" /}
<body>
<div class="mfc cbox headtop fl">
    <div class="sreach ret mfc ">
        <span class="fa fa-angle-left pabs-l-box fa-2x tc" style="width:1.6em;" onclick="history.go(-1)"></span>
        <p class="tc" onclick="history.go(-1)" style="font-size: 18px;line-height: 32px;">返回</p>
        <!--        <span class="pabs-r-box c-red tc" style="padding: 0 0.6em;"> 保存 </span>-->
    </div>
</div>
<div class="mfc order bc-back fl">
    <div class="cbox gap">
        <div class="mfc fl order-alist sr">
            {volist name="data" id="vo"}
            {volist name="vo.goods" id="vo2"}
            <div class="mfc fl">
                <div class="cell">
                    <div class="icon"><div class="sicon"><img src="{$vo2.single_pic}"></div></div>
                    <div class="info">
                        <h4 class="lh24">{$vo2.title}</h4>
<!--                        <p class="imark lh20">规格：10斤/箱</p>-->
                        <p class="imark lh20">数量：1</p>
                        <span class="price pabs-r-box"><span class="fa fa-cny"></span> {$vo2.price}</span>
                    </div>
                </div>
            </div>
            {/volist}
            {/volist}
        </div>
        <div class="mfc fl tsilk gap"></div>
        <div class="mfc fl order-distrib">
            <div class="mfc title-box">
                <p>选择配送方式：</p>
            </div>
            <label>
            <div class="mfc selectbox" onclick="ziti()">
                <input type="radio" name="express_type_id" value="2" > 单位自提
                <p class="info fs08 c-black">注意:（统一1月18日院内提货）</p>
            </div></label>
            <label>
            <div class="mfc selectbox">
                {if input('address_id')}
                <input type="radio" checked="checked" onclick="address()" name="express_type_id"  value="1">
                {else/}
                <input type="radio"  onclick="address()" name="express_type_id"  value="1">
                {/if}
                配送到家
<!--                <span class="info fs08 c-gray fr" id="kuaidiAdress"><a onclick="address()">选择地址</a> <span class="fa fa-angle-right"></span></span>-->
                <input type="hidden" name="adress" >
                <div class="mfc hide_address">
                    <div class="cell">

                        <div class="info">
                            <p><span>{$address.name}</span> <span class="">{$address.mobile}</span> </p>
                            <p class="imark">{$address.prov} {$address.city} {$address.area} {$address.address}</p>
                        </div>

                    </div>
                </div>
            </div>
            </label>
        </div>
    </div>
</div>


<div class="mfc cbox pfix-b-box">
    <div class="cbox order-option card tci">
        <button class="btnbox oval" onclick="package_order()">确认</button>
    </div>
</div>
<!--<div>-->
<!--    <video width="100%" height="240" controls>-->
<!--        <source src="/video.mp4" type="video/mp4">-->
<!--        您的浏览器不支持Video标签。-->
<!--    </video>-->
<!--&lt;!&ndash;    <video src="/video.mp4" width="100%"/>&ndash;&gt;-->
<!--</div>-->
<div class="Tbox">
    <div class="mask"></div>
    <div class="show">
        <div class="adress-select">

        </div>
    </div>
</div>
</body>
</html>
<style>
    *{ font-size: 18px;}
</style>
<script>


   $('[name="express_type_id"]').click(function () {
       var che =  $('[name="express_type_id"]:checked').val();
      if(che == 1){
          $('.hide_address').html('');
      }
   });
    // function ziti() {
    //     window.location.href = "{:url('gift_order')}?id={:input('id')}&unit_id={:input('unit_id')}&type_id={:input('type_id')}";
    // }
    function address() {
        localStorage.setItem('gift_address',window.location.href);
        window.location.href = "{:url('Address/index')}";
    }
    function package_order() {
        var id = {:input('id')};
        var unit_id = {:input('unit_id')};
        var type_id = {:input('type_id')};
        var che =  $('[name="express_type_id"]:checked').val();
        var address_id = "{:input('address_id')}";
        $.ajax({
            type: "POST", //用POST方式传输
            dataType: "json", //数据格式:JSON
            url: "{:url('package_order')}", //目标地址
            async: false,
            traditional :false,
            data:{id:id,unit_id:unit_id,type_id:type_id,express_type_id:che,address_id:address_id},
            success: function (ret) {
                console.log(ret);
                // alert(console.log(ret));
                if(ret.code == 200){
                    layer.msg(ret.message);
                    setTimeout(function () {
                        window.location.href = "{:url('Order/index')}?status=0";
                    },3000)
                }else{
                    layer.msg(ret.message);
                }
            }
        });
    }
</script>
